home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 August / ENTER.ISO / files / gimp-2.0.5-i586-setup.exe / {app} / share / gimp / 2.0 / scripts / rendermap.scm < prev    next >
Encoding:
Text File  |  2004-09-26  |  3.1 KB  |  87 lines

  1. ; Chris Gutteridge (cjg@ecs.soton.ac.uk)
  2. ; At ECS Dept, University of Southampton, England.
  3.  
  4. ; This program is free software; you can redistribute it and/or modify
  5. ; it under the terms of the GNU General Public License as published by
  6. ; the Free Software Foundation; either version 2 of the License, or
  7. ; (at your option) any later version.
  8. ; This program is distributed in the hope that it will be useful,
  9. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11. ; GNU General Public License for more details.
  12. ; You should have received a copy of the GNU General Public License
  13. ; along with this program; if not, write to the Free Software
  14. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15.  
  16.  
  17. (define (script-fu-render-map inSize
  18.                   inGrain
  19.                   inGrad
  20.                   inWiden)
  21.  
  22.   (set! old-gradient (car (gimp-gradients-get-gradient)))
  23.   (set! old-fg (car (gimp-palette-get-foreground)))
  24.   (set! old-bg (car (gimp-palette-get-background)))
  25.  
  26.   (set! theWidth inSize)
  27.   (set! theHeight inSize)
  28.   (set! theImage (car(gimp-image-new theWidth theHeight RGB)))
  29.  
  30.   (gimp-selection-all theImage)
  31.  
  32.   (set! theLayer (car (gimp-layer-new theImage theWidth theHeight
  33.                       RGBA-IMAGE
  34.                       "I've got more rubber ducks than you!"
  35.                       100 NORMAL-MODE)))
  36.   (gimp-image-add-layer theImage theLayer 0)
  37.   (plug-in-solid-noise TRUE theImage theLayer 1 0 (rand 65536)
  38.                inGrain inGrain inGrain)
  39.  
  40.   (if (= inWiden 1)
  41.       (begin
  42.     (set! thinLayer (car (gimp-layer-new theImage theWidth theHeight
  43.                          RGBA-IMAGE "Camo Thin Layer"
  44.                          100 NORMAL-MODE)))
  45.     (gimp-image-add-layer theImage thinLayer 0)
  46.  
  47.     (let ((theBigGrain (min 15 (* 2 inGrain))))
  48.       (plug-in-solid-noise TRUE theImage thinLayer 1 0 (rand 65536)
  49.                    theBigGrain theBigGrain theBigGrain))
  50.  
  51.     (gimp-palette-set-background '(255 255 255))
  52.     (gimp-palette-set-foreground '(0 0 0))
  53.  
  54.     (let ((theMask (car (gimp-layer-create-mask thinLayer 0))))
  55.       (gimp-layer-add-mask thinLayer theMask)
  56.  
  57.       (gimp-edit-blend theMask FG-BG-RGB-MODE NORMAL-MODE
  58.                GRADIENT-LINEAR 100 0 REPEAT-TRIANGULAR FALSE
  59.                FALSE 0 0 TRUE
  60.                0 0 0 (/ theHeight 2)))
  61.  
  62.     (set! theLayer (car(gimp-image-flatten theImage)))))
  63.     
  64.   (gimp-selection-none theImage)
  65.   (gimp-gradients-set-gradient inGrad)
  66.   (plug-in-gradmap TRUE theImage theLayer)
  67.   (gimp-gradients-set-gradient old-gradient)
  68.   (gimp-palette-set-background old-bg)
  69.   (gimp-palette-set-foreground old-fg)
  70.   (gimp-display-new theImage))
  71.  
  72. (script-fu-register "script-fu-render-map"
  73.             _"<Toolbox>/Xtns/Script-Fu/Patterns/Render _Map..."
  74.             "Another pattern which resembles a map"
  75.             "Chris Gutteridge: cjg@ecs.soton.ac.uk"
  76.             "28th April 1998"
  77.             "Chris Gutteridge / ECS @ University of Southampton, England"
  78.             ""
  79.             SF-ADJUSTMENT _"Image Size"       '(256 0 2048 1 10 0 0)
  80.             SF-ADJUSTMENT _"Granularity"      '(4 0 15 1 1 0 0)
  81.             SF-GRADIENT   _"Gradient"         "Land and Sea"
  82.             SF-TOGGLE     _"Gradient Reverse" FALSE
  83.             SF-OPTION     _"Behaviour"        '(_"Tile"
  84.                              _"Detail in Middle"))
  85.